package com.ruoyi.web.controller.certificates;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.TemporaryStaffAccount;
import com.ruoyi.system.domain.TemporaryStaffPersonnelAccount;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.service.TemporaryStaffAccountService;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/temporaryStaffPersonnelAccount")
public class TemporaryStaffPersonnelAccountController extends BaseController {

    @Autowired
    private ISysUserService sysUserService;
    @Resource
    private TemporaryStaffAccountService temporaryStaffAccountService;

    @GetMapping("list")
    public TableDataInfo queryByPage(TemporaryStaffPersonnelAccount temporaryStaffPersonnelAccount) {

        ArrayList<TemporaryStaffPersonnelAccount> response = new ArrayList<>();

        List<SysUser> sysUsers = sysUserService.selectUserList(new SysUser());

        List<TemporaryStaffPersonnelAccount> bankAccountVoList = sysUsers.stream().map(po -> {
            TemporaryStaffPersonnelAccount temporaryStaffPersonnelAccountResp = new TemporaryStaffPersonnelAccount();
            BeanUtils.copyProperties(po, temporaryStaffPersonnelAccountResp);
            return temporaryStaffPersonnelAccountResp;
        }).collect(Collectors.toList());


        List<TemporaryStaffAccount> temporaryStaffAccounts = temporaryStaffAccountService.selectList(new TemporaryStaffAccount());


        return getDataTable(response);

    }

}

